package com.cyr.daletou.controller;

import com.cyr.daletou.dao.model.DaletouHistoryEntity;
import com.cyr.daletou.dao.model.SsqHistoryEntity;
import com.cyr.daletou.service.SsqService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author chenyanrui
 * @since 2021/6/14
 */
@Api
@RequestMapping("/ssq")
@RestController
public class SsqController {
    @Autowired
    private SsqService ssqService;
    @ApiOperation("查询所有")
    @GetMapping("/getAll")
    public List<SsqHistoryEntity> getAll() {
        return ssqService.getAll();
    }
    @ApiOperation("范围查询")
    @GetMapping("/find")
    public Page<SsqHistoryEntity> findByPage(int pageIndex, int pageSize) {
        return ssqService.findByPage(pageIndex, pageSize);
    }
    @ApiOperation("抓取数据")
    @GetMapping("/fetch")
    public Object fetch(int start, int end) {
        return ssqService.fetch(start, end);
    }
    @ApiOperation("统计F1")
    @GetMapping("/count/f1")
    public Object countF1 (){
        return ssqService.countR1();
    }
    @ApiOperation("统计最高概率的3个数")
    @GetMapping("/count/top3")
    public Object countTop3 (){
        return ssqService.countTop3();
    }
}
